package muduo {
	import com.netease.protobuf.*;
	import flash.utils.Endian;
	import flash.utils.IDataInput;
	import flash.utils.IExternalizable;
	import flash.errors.IOError;
	import muduo.Datas;
	import muduo.Datas.Data;
	// @@protoc_insertion_point(imports)

	// @@protoc_insertion_point(class_metadata)
	public final class Datas extends com.netease.protobuf.Message implements flash.utils.IExternalizable {
		[ArrayElementType("muduo.Datas.Data")]
		public var d:Array = [];

		[ArrayElementType("Datas")]
		public var ds:Array = [];

		private var table_name$field:String;

		public function removeTableName():void {
			table_name$field = null;
		}

		public function get hasTableName():Boolean {
			return table_name$field != null;
		}

		public function set tableName(value:String):void {
			table_name$field = value;
		}

		public function get tableName():String {
			return table_name$field;
		}

		/**
		 *  @private
		 */
		override public final function writeToBuffer(output:WritingBuffer):void {
			for (var dIndex:uint = 0; dIndex < d.length; ++dIndex) {
				WriteUtils.writeTag(output, WireType.LENGTH_DELIMITED, 1);
				WriteUtils.write$TYPE_MESSAGE(output, d[dIndex]);
			}
			for (var dsIndex:uint = 0; dsIndex < ds.length; ++dsIndex) {
				WriteUtils.writeTag(output, WireType.LENGTH_DELIMITED, 2);
				WriteUtils.write$TYPE_MESSAGE(output, ds[dsIndex]);
			}
			if (hasTableName) {
				WriteUtils.writeTag(output, WireType.LENGTH_DELIMITED, 3);
				WriteUtils.write$TYPE_STRING(output, table_name$field);
			}
		}

		/**
		 *  @private
		 */
		override public final function readFromSlice(input:IDataInput, bytesAfterSlice:uint):void {
			var table_name$count:uint = 0;
			while (input.bytesAvailable > bytesAfterSlice) {
				var tag:uint = ReadUtils.read$TYPE_UINT32(input);
				switch (tag >>> 3) {
				case 1:
					const d$element:muduo.Datas.Data = new muduo.Datas.Data();
					ReadUtils.read$TYPE_MESSAGE(input, d$element);
					d.push(d$element);
					break;
				case 2:
					const ds$element:Datas = new Datas();
					ReadUtils.read$TYPE_MESSAGE(input, ds$element);
					ds.push(ds$element);
					break;
				case 3:
					if (table_name$count != 0) {
						throw new IOError('Bad data format: Datas.tableName cannot be set twice.');
					}
					++table_name$count;
					tableName = ReadUtils.read$TYPE_STRING(input);
					break;
				default:
					ReadUtils.skip(input, tag & 7);
				}
			}
		}

	}
}
